#include <cmath>
#include <iostream>
using namespace std;
bool isPerfect(int n)
{
	int sum = 1; // 先把1加上
	for (int i = 2; i <= sqrt(n); ++i)
	{
		if (n % i == 0)
		{
			sum += i;
			if (n / i != i)
				sum += n / i;
		}
	}
	return sum == n;
}
int main()
{
	int n = 0, cnt = 0;
	cin >> n;
	for (int i = 2; i <= n; ++i)
	{
		if (isPerfect(i))
			++cnt;
	}
	cout << cnt;
	return 0;
}